package com.itheima.stock.job.handler;

import com.itheima.stock.job.StockTimerTaskService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定义股票相关数据的定时任务
 * @author laofang
 */
@Component
public class StockJob {
    //private static Logger logger = LoggerFactory.getLogger(StockJob.class);

    @Autowired
    private StockTimerTaskService stockTimerTaskService;

    @XxlJob("getStockInnerMarketInfos")
    public void getStockInnerMarketInfos(){
        stockTimerTaskService.getInnerMarketInfo();
        System.out.println("大盘数据定时采集");
    }

    /**
     * 定时采集A股数据
     */
    @XxlJob("getStockInfos")
    public void getStockInfos(){
        stockTimerTaskService.getStockRtIndex();
    }

    /**
     * 板块定时任务
     */
    @XxlJob("getStockBlockInfoTask")
    public void getStockBlockInfoTask(){
        stockTimerTaskService.getStockSectorRtIndex();
    }


//    @XxlJob("hema_job_test")
//    public void jobTest(){
//        System.out.println("jobTest run.....");
//    }
//
//    public void init(){
//        logger.info("init");
//    }
//
//    public void destroy(){
//        logger.info("destory");
//    }
}